package com.hulk.dryad.admin.api.vo;

import com.hulk.dryad.common.annotation.Sensitive;
import com.hulk.dryad.common.constant.CommonConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jdk.nashorn.internal.objects.annotations.Setter;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author hulk
 * @date 2021/03/28
 */
@Data
@Accessors(chain = true)
@ApiModel(value = "在线用户令牌")
public class SysTokenVO implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键ID
	 */
	@ApiModelProperty(value = "主键")
	private Long userId;

	/**
	 * 用户名
	 */
	@ApiModelProperty(value = "用户名")
	private String username;


	/**
	 * 创建时间
	 */
	@ApiModelProperty(value = "创建时间")
	private LocalDateTime createdTime;

	/**
	 * 修改时间
	 */
	@ApiModelProperty(value = "修改时间")
	private LocalDateTime updatedTime;


	/**
	 * TOEKN值
	 */
	@ApiModelProperty(value = "令牌")
	@Sensitive(prefixNoMaskLen=8,suffixNoMaskLen=8)
	@ToString.Exclude
	private String token;

	@ApiModelProperty(value = "令牌过期时间")
	private LocalDateTime tokenExpireTime;

	/**
	 * 1:离线 0:在线
	 */
	@ApiModelProperty(value = "在线标记")
	private String onlineFlag;

	public void  setOnlineFlag(String onlineFlag){
		if(CommonConstants.STATUS_NORMAL.equals(onlineFlag)){
			this.onlineFlag="在线";
		}else{
			this.onlineFlag="离线";
		}

	}


}
